
package manager;

import remoteEntity.Comment;
import facade.CommentFacade;
import java.util.Date;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;

/**
 *
 * @author viktor
 */
@Stateless
@LocalBean
public class CommentManager implements CommentManagerRemote {
    @EJB
    private CommentFacade commentFacade;
    @EJB
    private UserManagerRemote userManager;
    
    //@Override
    public void removeComment(Comment comment){
        
        System.out.println("Will delete comment "+comment.getMessage());
        commentFacade.remove(comment);
    }
    
    @Override
    public void addComment(String message, int userId, Integer fileId) {
        Comment c = new Comment();
        c.setFiledescriptionId(fileId);
        c.setMessage(message);
        c.setTimestamp(new Date());
        c.setUserId(userId);
        commentFacade.addComment(c);
    }
}
